//package cn.fan.testfunction.even;
//
//import org.springframework.context.annotation.Configuration;
//import org.springframework.scheduling.annotation.AsyncConfigurer;
//import org.springframework.scheduling.annotation.EnableAsync;
//import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
//

/**
 * @Method 异步线程池配置
 * @Author HTHLKJ
 * @Date  2023/3/14
 * @Version 1.0
 * @Description
 */

//@Configuration
//@EnableAsync
//public class AsyncConfig implements AsyncConfigurer {
//    /**
//     * 手动注入线程池
//     */
//    @Override
//    public Executor getAsyncExecutor() {
//        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
//        //核心线程池数量
//        executor.setCorePoolSize(Runtime.getRuntime().availableProcessors());
//        //最大线程池数量
//        executor.setMaxPoolSize(Runtime.getRuntime().availableProcessors() * 5);
//        //线程池的队列容量
//        executor.setQueueCapacity(Runtime.getRuntime().availableProcessors() * 2);
//        //线程池名称前缀
//        executor.setThreadNamePrefix("async-executor-");
//        executor.initialize();
//        return executor;
//    }
//
//    @Override
//    public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
//        return new SimpleAsyncUncaughtExceptionHandler();
//    }
//}
